package top.broncho.lottery

import android.app.Application
import android.content.Context
import com.billy.android.swipe.SmartSwipeBack
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import top.broncho.lottery.di.AppInjector
import top.broncho.lottery.ui.main.MainActivity
import javax.inject.Inject
import kotlin.properties.Delegates

class App : Application(), HasAndroidInjector {
    @Inject
    lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>

    override fun androidInjector() = dispatchingAndroidInjector

    override fun onCreate() {
        super.onCreate()
        context = applicationContext
        AppInjector.init(this)
        SmartSwipeBack.activitySlidingBack(this) {
            it !is MainActivity
        }
    }

    companion object {
        var context: Context by Delegates.notNull()
    }

}